home *** CD-ROM | disk | FTP | other *** search
/ The CICA Windows Explosion! / The CICA Windows Explosion! - Disc 2.iso / programr / rsxwdk2s.zip / RSXWDK / LIBSRC / SYSEMX / FTRUNCAT.C < prev    next >
C/C++ Source or Header  |  1994-10-17  |  338b  |  18 lines

  1. #include <sys/emx.h>
  2. #include <sys/doscalls.h>
  3.  
  4. int __ftruncate (int handle, long length)
  5. {
  6.     long pos;
  7.  
  8.     if ((pos = dos_lseek(handle, 0, 1)) == -1)
  9.     return -1;
  10.     else if (pos > length) {
  11.     if (dos_lseek(handle, length, 0) != -1L)
  12.         return dos_write(handle, &pos, 0);
  13.     else
  14.         return -1;
  15.     }
  16.     return 0;
  17. }
  18.